import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart';
import 'package:kunlun_gas/app_files.dart';

import 'action.dart';
import 'state.dart';

Widget buildView(
    ChargeReusltViewState state, Dispatch dispatch, ViewService viewService) {
  return Scaffold(
    appBar: myAppBar(viewService.context, title: '支付结果'),
    backgroundColor: Colors.white,
    body: Stack(
      children: [
        Offstage(
          offstage: state.isFailed,
          child: Column(
            children: [
              Padding(
                padding: EdgeInsets.only(top: 60),
                child: Image.asset('images/ic_pay_search.jpg'),
              ),
              Text(
                '订单状态查询中...',
                style: TextThemeConfig.Font13WithColor99,
              ),
              Container(
                height: 50,
                width: double.infinity,
                margin: EdgeInsets.only(left: 15, right: 15, top: 80),
              ),
            ],
          ),
        ),
        Offstage(
          offstage: !state.isFailed,
          child: Column(
            children: [
              Padding(
                padding: EdgeInsets.only(top: 60),
                child: Image.asset('images/ic_pay_failed.jpg'),
              ),
              Text(
                '支付失败...',
                style: TextThemeConfig.Font13WithColor99,
              ),
              Container(
                height: 50,
                width: double.infinity,
                margin: EdgeInsets.only(left: 15, right: 15, top: 80),
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.all(Radius.circular(4)),
                  color: ThemeConfig.mainColor,
                ),
                child: MyInkWellWidget(
                  child: Center(
                    child: Padding(
                      padding: EdgeInsets.only(bottom: 1),
                      child: Text(
                        '确定',
                        style: TextThemeConfig.Font16WithWhite,
                      ),
                    ),
                  ),
                  onTap: () => Navigator.pop(viewService.context),
                ),
              ),
            ],
          ),
        )
      ],
    ),
  );
}
